package cn.junki.elasticsearchgeodemo.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.dromara.easyes.annotation.Distance;
import org.dromara.easyes.annotation.IndexField;
import org.dromara.easyes.annotation.IndexId;
import org.dromara.easyes.annotation.IndexName;
import org.dromara.easyes.annotation.rely.FieldType;

/**
 * @author Junki
 * @date 2023-09-07 10:23:23
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@IndexName(value = "merchant_doc")
public class Merchant {

    /**
     * es中的唯一id
     */
    @IndexId
    private String id;

    /**
     * 商家名称
     */
    @IndexField(fieldType = FieldType.TEXT)
    private String name;

    /**
     * 地理位置（用于：GeoDistance GeoBoundingBox GeoPolygon）
     */
    @IndexField(fieldType = FieldType.GEO_POINT)
    private String location;

    /**
     * 地理位置（用于：GeoShape）
     */
    @IndexField(fieldType = FieldType.GEO_SHAPE)
    private String geoLocation;

    /**
     * 距离（保留两位小数）
     */
    @Distance(decimalPlaces = 2)
    private Double distance;

}
